package com.dj.ms.support.mq;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * <br>
 * <p>
 * -
 * </p>
 *
 * <br>
 *
 * @author ZJG
 * @version 1.0
 * @date 2021/10/28 上午8:23
 */
@Data
@Primary
@Configuration
@ConfigurationProperties(prefix = "spring.rocketmq")
public class MqProperties {

    private boolean enableTransaction;

    /**
     * name server
     */
    private String nameServer;


    /**
     * 是否开启client端的日志
     */
    private boolean enableClientLog;

    /**
     * millis of send message timeout
     */
    private int sendMsgTimeout = 5000;

    private int consumeTimeout = 5;

    private int maxReconsumeTimes = 10;

    private int suspendTimeMillis = 1000;


    /**
     * Compress message body threshold, namely, message body larger than 4k will be compressed on default.
     */
    private int compressMsgBodyOverHowMuch = 1024 * 4;

    /**
     * <p> Maximum number of retry to perform internally before claiming sending failure in synchronous mode. </p>
     * This may potentially cause message duplication which is up to application developers to resolve.
     */
    private int retryTimesWhenSendFailed = 2;

    /**
     * <p> Maximum number of retry to perform internally before claiming sending failure in asynchronous mode. </p>
     * This may potentially cause message duplication which is up to application developers to resolve.
     */
    private int retryTimesWhenSendAsyncFailed = 2;

    /**
     * Indicate whether to retry another broker on sending failure internally.
     */
    private boolean retryAnotherBrokerWhenNotStoreOk = true;

    /**
     * Maximum allowed message size in bytes.  // 4M
     */
    private int maxMessageSize = 1024 * 1024 * 4;

}
